#pragma once

#include "TokenKinds.h"
#include "TypeAlias.h"

namespace cal
{

using col_t  = uint16_t;
using line_t = uint32_t; 

class Token
{
public:
    using size_type = std::string::size_type;

public:
    Token() :value{ "" }, kind{ tok::eof } { }
    ~Token() = default;

public:
    bool      empty() const { return kind == tok::eof; }
    size_type size()       const { return end - begin; }

public:
    std::string    value;
    tok::TokenKind kind;
    /**
     * 1. col 从 0 开始
     * 2.   token
     *      ^    ^
     *   begin   end (满足左闭右开)
     */
    col_t          begin;
    col_t          end;
    line_t         line;
};

}   // namespace cal
